Reading pen

ABSTRACT

A device, a method and a memory medium on which is stored a computer program for position determination are provided. The device ( 1 ) has a sensor ( 6 ) for recording an image of a position code ( 18 ) on a surface ( 4, 17 ), processing means ( 10 ) for determining a position on the surface based on the recorded image and at least a first writing means ( 11 ) for writing on the surface. The device is arranged to write on the surface by means of the first writing means, depending upon whether the position has been determined or not.

FIELD OF THE INVENTION

[0001] The present invention relates to a device for position determination which comprises a sensor for recording an image of a position code on a surface, processing means for determining a position on the surface based on the recorded image and at least a first writing means for writing on the surface. The invention also relates to a method and a memory medium on which is stored a computer program for position determination.

BACKGROUND ART

[0002] It is often useful to have pen and paper to hand to note down things that are important to remember. However, for the storage of information there are a plurality of alternatives to pen and paper, such as computers. The advantage of the use of computers is that the information can be stored digitally and forwarded straight away to other electronic units. The disadvantages are that computers are fairly expensive and unwieldy and that a user must have technical expertise in order to be able to work with them. Pen and paper can, on the other hand, be used by anyone, anywhere, and irrespective of the location, since they are easy to carry.

[0003] A communication method that is a combination of the above two storage alternatives is known from the Publication WO 01/16691, which is hereby incorporated by reference. The application describes a system for electronic recording and processing of information. The system consists of a base which is provided with a position code for coding positions on the base, and a device for recording the information that is written on the base by detection of the position code. The position code is recorded continuously while the information is being written down by hand. The succession of positions that is recorded defines the movement of the device across the base. The information is recorded at the same time as it is being written down and it can be stored in the device or transferred to an external unit such as a computer or a mobile telephone.

[0004] WO 00/25293, which is hereby incorporated by reference, describes a device and a method for determining the movement of a pen point. The movement of the pen is determined by comparison of images of the base that are recorded in succession. According to one aspect, the movement of the pen is determined by absolute positioning. Alternatively, different areas are provided with different patterns. When the pen is positioned in one of the areas, it can identify what type of area it is by analyzing the pattern in the area. The resultant analysis can, for example, be used to determine whether the pen is to write on the base or not.

[0005] It sometimes happens that a device of the above type does not manage to record a position on the base. This implies that some of the information that a user writes down is also not recorded. The user will not be able to be certain that the information that is stored in the device or transferred to an external unit is complete. If information is missing, a supplementary recording must be carried out at a later time, an operation that can be very time-consuming.

SUMMARY OF THE INVENTION

[0006] An object of the present invention is to overcome the above-mentioned problems relating to prior-art technique.

[0007] This object is achieved according to the invention by means of a device, a method and a memory medium on which is stored a computer program, which have the features that are defined in the independent claims. Preferred embodiments are defined in the dependent claims.

[0008] A device for determining a position by means of a position code on a surface comprises, according to the invention, a sensor for recording an image of the position code, processing means for determining a position on the surface based on the recorded image and at least a first writing means for writing on the surface. The device is characterized in that it is arranged to write on the surface by means of the first writing means, depending upon whether the position has been determined or not.

[0009] As the device is arranged to write on the surface by means of the first writing means, depending upon whether the position on the surface has been determined or not, a user will be able to know precisely what information is being recorded by the device, since the recorded information is precisely what is written/not written on the surface by means of the first writing means.

[0010] The device is preferably arranged to write on the surface by means of the first writing means only in the event of a position on the surface having been able to be determined. This means that the information that is written on the surface by means of the first writing means is the information that is recorded by the device. If the device ceases to write on the surface by means of the first writing means, this is an indication that a position on the surface has not been able to be determined and that all the information has not been able to be recorded. A supplementary recording of the information that is missing can then be carried out straight away by filling in the places on the surface where the information is missing. This alternative is the most preferable, among other reasons because the use of the device is made easier if the user can see what he or she is writing or drawing on the surface. Of course, the alternative with the device working in the opposite way is also possible, that is that it writes on the surface by means of the first writing means only in the event of a position on the surface not having been able to be determined. This means that if the device starts to write on the surface by means of the first writing means, this is an indication that a position on the surface has not been able to be recorded.

[0011] When an image of the position code has been recorded by the device, this will determine a position on the surface if the image contains enough information. If not, the image is rejected. The device is advantageously arranged, in the event of a position on the surface having been determined, to calculate a position probability that the determined position is a correct position of the device on the surface. The calculated position probability can then be used to determine whether the device is to write on the surface or not.

[0012] The device is preferably arranged to compare the position probability with a predetermined position limit value. If the position probability is higher than the position limit value, the position is considered to be a correct position of the device on the surface. If, on the other hand, the position probability is lower than the position limit value, the position of the device is not considered to be determined with sufficient accuracy. This implies that the position is rejected as being unusable for the position determination of the device. The device is preferably arranged to write on the surface using the first writing means, depending upon whether the position is considered to be correct.

[0013] The device is advantageously arranged to write on the surface by means of the first writing means only in the event of the position probability being higher than the position limit value. This corresponds to the case described above, in which writing is only to be carried out on the surface in the event of a correct position of the device on the surface having been able to be determined so that a user can see what he or she is writing and drawing. The opposite is of course possible, but, for the reasons given above, the previous alternative is again the most preferable.

[0014] The device is advantageously arranged to identify marks in the position code in the recorded image, each of which marks defines one of at least two possible values. Usually one single value for a mark cannot be determined unambiguously. The reason for this can be that the position code on a surface is not completely perfect. When the position code is printed on a surface, the limited resolution of the printer can imply that the marks are not printed with complete precision. One reason might, for example, be that they are printed to some extent deformed or displaced from their correct position. Another reason can be that the device is held above the surface at various angles, that is the reading is carried out from varying perspectives, wherein the resultant image distortion can lead to difficulties in determining unambiguously the values of the marks. It can sometimes happen that the device is held above the surface at such an oblique angle that a mark cannot be identified at all. Other factors that can interfere with the identification of marks on the surface are uneven illumination of the surface or lack of sharpness that is introduced when the device is held at different distances from the surface during the identification of the marks.

[0015] It can thus be difficult to determine unambiguously the values of the marks. The device is therefore preferably further arranged to calculate, for each of the identified marks and for each of the values, a value probability that the mark has this value and to determine the position on the surface based on said value probabilities.

[0016] If a mark is determined unambiguously, the value probability that corresponds to the unambiguously determined value of the mark will be maximal, while the other value probabilities for the mark are zero. The more uncertain the value of a mark, the less difference there is between its value probabilities.

[0017] The device is preferably arranged to calculate the position probability for each recorded image based on the value probabilities for a set of marks in the image, for example by multiplication of the highest value probabilities for each mark in the set. The position can thereafter be determined based on the position probability. The position probability for a recorded image can, of course, be calculated in other ways than the one described above.

[0018] The set of marks for the position determination is chosen from all the identified marks and they can advantageously be the marks in the recorded image that have a high value probability for one single value and low value probabilities for the other possible values. The set of marks thus consists preferably of the marks in the recorded image that provide the most information about the position on the surface.

[0019] As mentioned above, the device is preferably arranged to compare the position probability for each image with a predetermined position limit value. If the position probability is higher than the position limit value, the image can advantageously be used for the position determination. In the event of the position probability being lower than the position limit value, the image is considered not to contain enough information, which implies that the image can advantageously be rejected. This means that if the marks in the image of the position code that is recorded have well-defined values, that is if each of them has a value probability that is higher, preferably considerably higher, than its other value probabilities, the position probability will be considerably higher than the position limit value, which in turn means that a first and a second coordinate for the position can probably be determined with great accuracy.

[0020] According to an alternative embodiment of the present invention, no probabilities are calculated at all, but a position is calculated instead from the recorded image, after which the position is compared with the previous recorded position. The position is only accepted as a correct position if the position lies within a predetermined distance from the previous recorded position. According to a further embodiment, a combination of position determination with and without the calculation of probabilities can be used. For example, position determination with probability calculations can be used to determine the initial coordinates in a succession of coordinates that corresponds to a stroke with the device across the surface, with the other coordinates being determined without probability calculations. This last embodiment enables a more rapid determination of whether ink is to be ejected than the above embodiments individually.

[0021] The device is preferably arranged to identify in the recorded image a raster comprising raster lines which intersect at raster points. The raster is preferably in the form of a square grid, but other forms are also possible. The device is advantageously further arranged to associate each of the marks with a raster point. The raster thus constitutes a type of reference for the marks and the fitting of the raster makes it possible to determine to which raster point each mark belongs.

[0022] According to one embodiment, the device is arranged to identify marks, the value probabilities of which are defined by their size in relation to a number of ideal sizes, which correspond to the value probability 1 for one value and to 0 for other values.

[0023] According to another embodiment, marks are identified, the value probabilities of which are defined by their location in relation to the raster, and preferably the distance of the marks from each of a number of ideal locations defines the value probabilities of the marks. The ideal locations for a mark can, according to one embodiment, be on each of the raster lines that extend from the raster point with which the mark is associated, at equal distances from the raster point. If the raster is a square grid, this embodiment involves four ideal locations for a mark. In this case, the ideal locations correspond to the value probability 1 for one single value and 0 for other values.

[0024] In a preferred embodiment, the device comprises a second writing means for writing on the surface. This second writing means is advantageously arranged to write on the surface irrespective of whether the position has been determined or not. This embodiment makes it possible for a user to follow all the movements of the device on the surface, since the device now functions as a conventional pen. Precisely as in the previous embodiments, however, a user is made aware that a position on the surface has not been able to be determined by the first writing means ceasing/starting to write on the surface.

[0025] According to another embodiment, the second writing means can be arranged to write on the surface in the positions in which the first writing means is not writing. Also this embodiment makes it possible for a user to follow all the movements of the device on the surface.

[0026] The first writing means can, for example, write with red ink, while the second writing means writes with black ink, which means that the color of the writing on the surface indicates whether the position has been able to be determined.

[0027] A device according to the invention is preferably provided with a transceiver for wireless transmission of data from the device to an external unit. The information that has been recorded by means of the device can thereby be sent, for example, to an adjacent computer or via a mobile telephone to another computer or mobile telephone. The transmission can be carried out by short-range radio link or by infrared light. Alternatively, the information is transmitted via cables.

[0028] There are many different techniques by which a device according to the present invention can write on a surface. In a preferred embodiment, the first writing means is a nozzle that is arranged to eject ink onto the surface in certain positions. The second writing means is advantageously also a nozzle that is arranged to eject ink onto the surface. This embodiment enables a rapid regulation of the flow of ink to the surface, that is the flow can easily be turned on and off.

[0029] By ejecting is meant in this connection that ink is discharged from the nozzle.

[0030] The device in accordance with the present invention is preferably hand-held and has advantageously a shape that makes it easy to handle. In particular, the device can be in the form of a pen for maximal comfort for the user.

[0031] According to a second aspect, the invention relates to a method for determining a position by means of a position code on a surface. The method comprises the steps of recording an image of the position code and processing the image to determine a position on the surface based on the recorded image. The method is characterized by the step of writing on the surface, depending upon whether the position has been determined or not.

[0032] According to a third aspect, the invention relates to a memory medium on which is stored a computer program for position determination by means of a position code on a surface. The computer program comprises instructions for causing a computer to receive an image of the position code as input, to process the image to determine a position, and to provide as output information concerning whether the device is to write on the surface, depending upon whether the position has been determined or not.

[0033] According to a fourth aspect of the invention, the invention relates to a device for position determination by means of a position code. The device is characterized in that it is arranged to receive an image of the position code as input, to process the image to determine a position, and to provide as output information concerning whether the device is to write on the surface, depending upon whether the position has been determined or not. Such a device consists preferably of an application-specific integrated circuit (ASIC), but can also consist of another circuit that also contains discrete components.

[0034] The features that have been discussed in connection with the device above can, of course, also be applied to the method or the memory medium according to the invention.

[0035] The above features can of course be combined in the same embodiment.

BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The present invention will now be described in more detail by means of embodiments and with reference to the accompanying drawings.

[0037]FIG. 1 shows a device according to a preferred embodiment of the present invention.

[0038]FIG. 2 shows an example of a position code that can be used in connection with a device according to the invention.

[0039]FIG. 3 shows four ideal locations for a mark.

[0040]FIG. 4 shows how the value probabilities of the marks are calculated.

[0041]FIG. 5 shows how raster point probabilities are calculated from value probabilities.

[0042]FIG. 6 shows how matrices for the position determination are constructed.

[0043]FIG. 7 shows steps in the calculation of position coordinates.

[0044]FIG. 8 illustrates how the processor works in a device according to the invention.

[0045]FIG. 9 shows an example of a result from use of a device according to the present invention on a surface.

[0046]FIG. 10 shows part of a device according to an alternative embodiment of the present invention.

[0047]FIG. 11 shows alternative techniques for writing on a surface.

[0048]FIG. 12 shows a cyclic binary number series that is used for decoding binary sequences.

[0049]FIG. 13 illustrates steps in the calculation of position coordinates.

[0050]FIG. 14 shows another type of position code that can be used in connection with the invention.

[0051]FIG. 15 shows two further examples of position codes that can be used in connection with the invention.

DETAILED DESCRIPTION OF THE INVENTION

[0052]FIG. 1 shows a device 1 in the form of a reading pen for position determination according to a preferred embodiment of the present invention. It comprises a casing 2 which has approximately the same shape as a pen. In the short side of the casing there is an opening 3. The short side is intended to abut against or to be held a short distance from the surface 4 on which the position determination is to be carried out.

[0053] The device 1 comprises at least one light-emitting diode 5 for illuminating the surface 4 which is to be imaged and a light-sensitive area sensor 6, for example a CCD or CMOS sensor, for recording a two-dimensional image. If required, the device 1 can also contain a lens system 7.

[0054] The power supply for the device 1 is obtained from a battery 8, that is mounted in a separate compartment in the casing 2.

[0055] The device 1 comprises in addition an image-processing means 9 for determining a position on the basis of the image recorded by the sensor 6 and more specifically a processor unit 10 that is programmed to record images from the sensor 6 and to carry out position determination on the basis of the images.

[0056] In this embodiment, the device 1 also comprises a first writing means in the form of a nozzle 11 which ejects ink and by means of which it is possible to write or draw on the surface 4.

[0057] According to a preferred embodiment, the nozzle is a typical ink-jet nozzle. With such a nozzle, when the ejection of ink is stopped, the supply of ink to the nozzle is simply turned off.

[0058] The device 1 can further comprise buttons 12, by means of which the device can be activated and controlled. It has also a transceiver 13 for wireless transmission, for example using infrared light or radio waves, of information to and from the device. The device 1 can further comprise a display 14 for displaying positions or recorded information.

[0059] A pressure sensor 75 is arranged to indicate when the device 1 abuts against the surface 4. The area sensor 6 is activated when the pressure sensor abuts against the surface. The area sensor can thus not record images without the pressure sensor indicating that the device abuts against the surface.

[0060]FIG. 2a shows a sheet of paper 15 that has a surface 16 that is provided with an optically readable position code 17 consisting of marks 18, which position code is greatly enlarged for the sake of clarity. FIG. 2b shows a further enlarged part 19 of the position code 17 in FIG. 2a.

[0061] The device illuminates the marks with infrared light so that they become visible to the area sensor 6. The ink that is ejected from the nozzle 11 is of such a type that it is not visible to the area sensor 6 when it is illuminated with infrared light. This means that the function of the device is not impaired by the marks being overwritten by the ink. This can be achieved, for example, by the ink not containing any carbon.

[0062] The device is arranged to record an image of the position code, to identify marks 18 in the image and to fit a raster 20 to the image, with raster lines 21 that intersect at raster points 22. The fitting is carried out so that each of the marks 18 is associated with a raster point 22. For example, the point 23 is associated with the raster point 24.

[0063] The function of the device in FIG. 1 will now be described with reference to FIGS. 1, 2 and 9. The reading pen in FIG. 1 is used to record handwritten text at the same time as it is being written. FIG. 9 shows an example of a result from use of a reading pen 1 according to the present invention on a surface. In the example, the text “Anoto” 72 is to be written with the reading pen 1 and stored in the pen. While the user is writing, images of the surface on which the user is writing are continually recorded. The recorded images comprise a position code that is converted into a position in the reading pen. If the probability that the position is correct is too low or if no position has been able to be determined at all, according to a preferred embodiment, no ink is ejected. Ink is only ejected if an acceptable position is determined based on the recorded image. In the text in FIG. 9, the letter “t” in “Anoto” is missing. This is due to the fact that the reading pen has not determined an acceptable position in the pattern when the letter “t” was written, and has therefore also not discharged any ink. The calculation of a position based on a recorded image will be described in greater detail below in connection with the description of how a position is determined based on a position code.

[0064] There are a plurality of alternative ways of deciding whether an acceptable position has been determined. There are in principle two alternatives for deciding whether the position is acceptable.

[0065] According to a first embodiment, the decision is based on probability calculations. A probability that the position is correct is calculated based on the probability that individual marks in the position code are correct. If the probability that the position is correct is sufficiently high, the position is considered to be acceptable. Probability calculations will be described in greater detail below.

[0066] According to a second embodiment, the decision whether a position is correct is based on a comparison between the recorded position and one or more of the previously recorded positions. If the recorded position is located too far away from previously recorded positions, the position is rejected as being not acceptable for position determination.

[0067] It is, of course, possible to combine probability calculations with a comparison of the position with previously recorded positions. According to this embodiment, a probability is first calculated that the position is correct. If the probability is sufficiently high, the recorded position is compared with one or more previously recorded positions. If the recorded position is located within a predetermined distance from the previously recorded positions, the position is accepted. Otherwise, the position is rejected as not acceptable.

[0068] According to an alternative embodiment, this is carried out in the reverse order, the decision being based firstly on whether the position is located sufficiently close to previously recorded positions and secondly on the probability that the position is correct.

[0069] According to a further alternative method, probability calculations are carried out for a few initial images when a curve that is written on the sheet of paper is recorded. After the initial images have been recorded, a position is calculated from each recorded image. A position that has been calculated from a recorded image is then rejected if it is located too far from the previous recorded image.

[0070] It is, of course, possible to eject ink only when an acceptable position has not been recorded, instead of ejecting ink when an acceptable position has been recorded. It is also possible to have more than one ejection means, for example one ejecting ink all the time and the other ejecting ink of another color when an acceptable position has not been recorded.

[0071]FIG. 8 shows a flow chart of how the processor works in a device according to the invention. If the pressure sensor 15 signals that the reading pen is abutting against the surface, the area sensor 6 is activated. An image of the base is then recorded by the area sensor, and if the position of the device in the pattern has been able to be determined with sufficient certainty, the processor sends out a signal that ink is to be supplied to the nozzle for ejecting onto the surface. Otherwise, no ink is ejected, that is nothing is written on the surface.

[0072]FIG. 10 shows a part of a device according to an alternative embodiment of the present invention, which device is provided with a first writing means 43 and a second writing means 44. The first writing means 43 is arranged to write on the surface only in the event of a position having been determined. The second writing means 44 is arranged to write on the surface irrespective of whether a position has been determined or not.

[0073] The writing of information on a surface by means of a device according to the present invention can be carried out in several different ways. For example, instead of being a nozzle, the writing means could be a ballpoint 45 for rolling ink onto the surface, as shown in FIG. 11a. When the supply of ink to the surface is turned off, this is suitably carried out by locking the ball so that it can no longer roll on the surface. Another alternative is shown in FIG. 11b where an electromagnet 46 is used as a writing means for writing on a special paper containing small permanent magnets with a black and a white side. This paper works in such a way that when a magnet is passed over the surface they turn their black side upwards. Instead of turning on and off the supply of ink from a nozzle, the supply of electricity to the electromagnet 46 could thus be turned on and off in order in this way to control the writing of information, depending upon whether a position has been determined or not. A further alternative, which is shown in FIG. 11c, could be to have a heating means 47 as a writing means, for heating up a surface that has the property that it changes color when it is heated up.

[0074] In the following, the calculation of probabilities and positions will be described in greater detail.

[0075] The device is arranged to record an image of the position code in FIG. 2, to identify marks 18 in the image and to fit a raster 20 to the image, with raster lines 21 that intersect at raster points 22. The fitting is carried out in such a way that each of the marks 18 is associated with a raster point 22. For example, the point 23 is associated with the raster point 24.

[0076] The value of the marks 18 is defined by their displacement in relation to the raster points 22 with which they are associated. In this embodiment, there are four ideal locations for each mark, each of which corresponds to the value probability 1 for one singe value. These locations are on each of the four raster lines 21 extending from the raster point 22 with which the mark is associated, which locations are situated at an equal distance from the raster point. The ideal locations 25 for a mark are shown enlarged in FIGS. 3a-d. They have the value “0” in FIG. 3a, the value “1” in FIG. 3b, the value “2” in FIG. 3c and the value “3” in FIG. 3d. Each mark can thus represent four different values “0-3”.

[0077] For various reasons, the identified marks often do not have an ideal location. In many cases it can therefore be difficult to determine unambiguously one value for a mark. Because of this, the device is arranged to calculate, for each mark and for each value “0-3”, a value probability that the mark has this value. The value probabilities for each mark are a decreasing function of the distances 26 from the mark 27 to each of its ideal locations 25, see FIG. 4. According to a preferred embodiment, the marks are assumed to be normally distributed around the ideal locations, which means that the value probabilities, P_(v) can be calculated by the formula P_(v)=k exp(−(d_(i))²/v) where k=a constant, d_(i)=the distance from a mark to an ideal location and v=the variance.

[0078] Four value probabilities can thus be calculated for each mark. It sometimes happens that a mark is found in the center of a raster point. In these cases, the four value probabilities for the mark will be equal, since the distances from the mark to each of the ideal locations are equally large. The case when there is no mark associated with a raster point is treated as if there was a mark in the center of the raster point, that is the value probabilities are equally high.

[0079] If there is more than one mark, for example three, associated with a raster point, there are 3×4 value probabilities for the raster point. The device is therefore arranged to determine, for each raster point and for each value, raster point probabilities that the marks associated with the raster point together define this value. In this embodiment, the raster point probabilities are determined by the highest value probability from among the associated marks being chosen for each value. Alternatively, the raster point probabilities can be weighted sums of the value probabilities for the values of the associated marks.

[0080] The calculation of the raster point probabilities in this embodiment is illustrated by means of the number example in FIG. 5. FIG. 5a shows a raster point 22 with two associated marks 28 and 29. The tables 30 and 31 in FIG. 5b contain the value probabilities P₁ for the respective marks. The table 32 in FIG. 5c contains the resultant raster point probabilities P₂ for the raster point 22. In this example, the raster point probabilities are relative. Alternatively, they can instead be normalized in a suitable way. If there is only one mark associated with a raster point, the raster point probabilities are obviously equal to the value probabilities.

[0081] When recording an image, the distance from the device to the surface influences how large a part of the position code is recorded and thus also how large a raster can be fitted to the image. For converting the image into a position, the marks are used that are associated with 8×8 of the fitted raster points. If more than 8×8 raster points have been fitted to the image, an excess of marks is thus identified. The device is therefore in addition arranged to choose from all the fitted raster points the set of raster points that provides the most information about the position on the surface, which set is continuous according to a preferred embodiment. For this purpose, the entropy is calculated for each of all the fitted raster points. Thereafter the 8×8 raster points are chosen that give the smallest entropy sum. The entropy for a raster point is calculated according to the following formula if the raster point probabilities are normalized so that ${\sum\limits_{i}P_{i}} = 1$ $H = {- {\sum\limits_{i}{P_{i\quad}{\ln \left( P_{i} \right)}}}}$

[0082] where P_(i) is the raster point probability for the value i and where ln is the natural logarithm. The entropy for a raster point is thus maximal when the raster point probabilities are equally high and minimal when all except one of the raster point probabilities are zero. An alternative to choosing 8×8 raster points by means of entropy calculations is instead to use the highest raster point probability for each raster point as an information value and to choose the continuous 8×8 raster points that give the largest sum of the information values.

[0083] In the position code, the four different values “0-3” are used to code a binary bit in each of two directions. For each of the 8×8 raster points, the device is thus arranged to convert the values into the four different bit combinations (0, 1), (0, 0), (1, 0) and (1, 1), which bit combinations have the raster point probabilities belonging to the values, see the continuation of the previous number example in the table 33 in FIG. 6a. In the bit combinations, the first number refers to a first direction and the second number refers to a second direction.

[0084] For the 8×8 raster points, the device is arranged to separate the raster point probabilities into zero-probabilities and one-probabilities. In this embodiment, this is carried out for each of the raster points by the raster point probabilities that correspond to the first number being a zero being compared, the highest raster point probability being chosen as the zero-probability which is saved in a first matrix 34. Then the raster point probabilities are compared that correspond to the first number being a one, the highest raster point probability being chosen as the one-probability which is saved in the first matrix 34. Thereafter the above procedure is repeated for the second number and for a second matrix 35. The result is illustrated in the continuation of the number example in FIG. 6b. According to other embodiments, a first and a second matrix with zero-probabilities and one-probabilities for the 8×8 raster points can be created by the raster point probabilities that correspond to the first number being a zero being added, the sum being saved as the zero-probability, and by the raster point probabilities that correspond to the first number being a one being added, the sum being saved as the one-probability, the above procedure being repeated for the second number.

[0085] Thus, the 8×8 raster points now correspond to two matrices, 34 and 35, each with 8×8 elements. Each of the elements contains a zero-probability and a one-probability, corresponding to a zero and a one respectively. By means of these first and second matrices, a first coordinate and a second coordinate respectively can be determined for the position.

[0086] The device is arranged to determine for the first matrix different binary sequences of size eight by means of a first cyclic number series. The first cyclic number series is binary, that is it consists of a succession of zeros and ones, and it contains only mutually unique number sequences of a given length. All possible different binary sequences of size eight are not represented in the first cyclic number series. The reason for this is that if the position code was completely perfect, only 6×6 marks, that is 6×6 raster point probabilities for 6×6 raster points, would be required to determine a position. There are 2⁶ different binary combinations, that is 64 combinations, if number sequences of length 6 are used. A cyclic number series containing 64 unique number sequences should consequently cover all possible cases of sequences of length 6. A condition for a cyclic number series for decoding according to the invention is, however, that a number sequence of a given length cannot occur inverted or backwards in the number series, which leads to the cyclic number series containing 63 number sequences for decoding sequences of size 8. By using a longer sequence for the decoding than the shortest possible, an excess of zero-probabilities and one-probabilities is obtained, which gives room for error-correction.

[0087] For each of the columns in the first matrix, the device is arranged to compare each of the 63 different number sequences with the corresponding binary sequence in the first matrix. For each number sequence in the first cyclic number series, the device is in addition arranged to calculate a first sequence probability for the corresponding binary sequence by multiplication of the raster point probabilities that correspond to the sequence. After this operation, there will thus be 63 first sequence probabilities with an associated unique sequence value each for each column in the first matrix, which sequence values are defined by the positions of the corresponding sequences in the first cyclic number series. The device is arranged to choose for each column the highest first sequence probability and the corresponding sequence value and to save these. During the decoding, redundant information is thus used to obtain error-correction properties. In the example described above, 8×8 raster points are used for the decoding, in spite of the fact that the position information can be extracted based on 6×6 raster points, that is the image contains 56 bits of redundant information [(8²−6²)×2]. During the decoding, the information in the current image is matched, in this case by columns, with the different number sequences that can occur in the position code, using the raster point probabilities associated with the current image. The combination of redundant information, probabilities and a known condition for the respective values of the raster points provides a good insensitivity to interference in the current image. The value of each individual mark thereby decreases in significance, since the value of the individual mark must conform with the other values in the number sequence that gives the highest sequence probability.

[0088] Alternatively, if the need for error-correction is more limited, the device can be arranged to choose a binary sequence straight away for each of the columns in the first matrix, and thus a sequence value corresponding to the highest of the zero-probability and the one-probability at each place.

[0089]FIG. 7 shows an example of a binary sequence 36, an example of a column 37 in a first matrix and how the first sequence probability 38 corresponding to the sequence is calculated.

[0090]FIG. 12 shows an example of a first cyclic number series 39 for decoding the sequence 36.

[0091] A device according to the present invention is rotatable in various locations in relation to a surface. As there are four possible reading directions for the raster, which reading directions are indicated by arrows 40 in FIG. 13, the position code can be read in four different ways. For this reason, for each of the reading directions of the raster, the device is arranged to determine the highest first sequence probability for each column, in the way described above, and to calculate a first rotation probability for each of the rotational locations, by multiplication of the highest first sequence probabilities for each column. The binary matrix 42 contains examples of columns with sequences 43, that can correspond to the sequence values, Sx₁-Sx₈ for 8×8 raster points. The binary matrix 42 is not generated in reality but is only shown in order to clarify the method.

[0092] The device is further arranged to compare each of the 63 different number sequences with the corresponding binary sequence in the second matrix, in a corresponding way for each of the rows in the second matrix. For each number sequence in a second cyclic number series, which has the same properties as the first cyclic number series, the device is further arranged to calculate a second sequence probability for the corresponding binary sequence by multiplication of the raster point probabilities that correspond to the sequence. After this operation, there will thus be 63 second sequence probabilities, each with an associated unique sequence value for each row in the second matrix, which sequence values are defined by the positions of the corresponding sequences in the second cyclic number series.

[0093] Also here the device can alternatively be arranged to choose straight away a binary sequence for each of the rows in the second matrix and thus a sequence value corresponding to the highest of the zero-probability and the one-probability at each place.

[0094] The device is further arranged to determine, for each of the reading directions of the raster, the highest second sequence probability for each row in the above way, and to calculate a second rotation probability for each of the rotational locations by multiplication of the highest second sequence probabilities for each row. The binary matrix 45 contains examples of rows with sequences 46 that can correspond to the sequence values Sy₁-Sy₈ for 8×8 raster points. Nor is the binary matrix 45 generated in reality, but is only shown in order to clarify the method.

[0095] The device is then arranged to calculate, for each rotational location, a total rotation probability by multiplication of the first and the second rotation probability that correspond to the rotational location. The device is further arranged to choose for the position determination the sequence values Sx₁-Sx₈, Sy₁-Sy₈ that correspond to the rotational location that has the highest total rotation probability.

[0096] The device is further arranged to calculate, for the chosen sequence values, the difference between adjacent sequence values, which gives rise to two sets 47 and 48 with seven difference values Dx₁-Dx₇ and Dy₁-Dy₇. These difference values are then used to generate a first coordinate and a second coordinate.

[0097] For the calculation of the first coordinate, according to this embodiment, however, only six of the sequence values Sx₁-Sx₈, are needed, that is five of the difference values Dx₁-Dx₇. According to one embodiment, use is made of the sequence values Sx₂-Sx₇ and thus the difference values Dx₂-Dx₆. The same applies to the second coordinate that is then calculated from the sequence values Sy₂-Sy₇ and thus the difference values Dy₂-Dy₆. Alternatively, only 6 sequence values are determined for each direction, Sx₂-Sx₇ and Sy₂-Sy₇ respectively.

[0098] The conversion from difference values to coordinates can be carried out in many different ways, for example as described in Applicant's Application WO 01/26033 which is hereby incorporated by reference.

[0099]FIG. 14 shows a sheet of paper 49 that has a surface 50 that is provided with an alternative position code 51 which consists of marks 52 and which for the sake of clarity is greatly enlarged. According to this embodiment, the value of the marks 52 is defined by their size. This type of position code is described in Patent Publication WO 00/79383 which is hereby incorporated by reference.

[0100] In this case, the device is arranged to record an image of the position code, precisely as above, to identify marks in the image and to fit a raster to the image so that each of the marks is associated with a raster point. In this embodiment, there are two possible values for each mark. The small mark 53 corresponds to a zero and the large mark 54 corresponds to a one, and there is an ideal size of the marks that unambiguously defines their value.

[0101] The identified marks are usually not of an ideal size. In many cases, it can therefore be difficult to determine unambiguously one value for each mark 52. The device is therefore arranged as above to calculate, for each mark and for each value “0” and “1”, a value probability that the mark has this value. According to a preferred embodiment, the size of the marks 52 is assumed to be normally distributed around the ideal sizes, which means that the value probabilities, P_(v) can be calculated by the formula P_(v)=k exp(−(R_(i)−r)²/v)), where k=a constant, R_(i)=ideal size, r=size of a mark and v=the variance.

[0102] Thus, for each mark, two value probabilities can be calculated. In the case in which there is no mark associated with a raster point, this is dealt with as if there were two marks of ideal size, one with the value “0” and one with the value “1”, associated with the raster point, whereby the value probabilities are equally high.

[0103] If there is more than one mark, for example three, associated with a raster point, then there are 3×2 value probabilities for the raster point. The device is therefore arranged as above to determine, for each raster point and for each value, raster point probabilities that the marks associated with the raster point together define this value. The raster point probabilities can be determined as above by the highest value probability from among the associated marks being chosen for each value. Alternatively, the raster point probabilities can be weighted sums of the value probabilities for the values for the associated marks.

[0104] Also in this embodiment, it is the case that the raster point probabilities are equal to the value probabilities if there is only one mark associated with a raster point.

[0105] In several different cases above, probabilities have been multiplied to obtain various results. It can be pointed out that in cases in which the probabilities that are to be multiplied are described by exponential functions, logarithms can be used, so that the results are obtained instead by summing exponents according to the following formula.

ln(exp(a)·exp(b))=ln(exp(a))+ln(exp(b))=a+b

[0106]FIGS. 11a and b show two additional types of codes that can be used in connection with the present invention. The code 55 in FIG. 15a consists of marks 56 in the form of small lines. The values of the marks 56 depend upon the inclination of the lines. The mark 57 corresponds to the value “0” and the mark 58 corresponds to the value “1”. This type of code is described in the application U.S. Pat. No. 5,245,165, which is hereby incorporated by reference. The code 59 in FIG. 15b consists of a square grid 60, with triangles 61 being placed in the squares. The square 62 has the value “0” and the square 63 has the value “1”.

[0107] Another code that can be used in connection with the present invention consists of marks that have two different ideal shapes, a first and a second ideal shape, with the density of the marks on a surface providing information about the position. In this embodiment, the density varies in two dimensions, the density of marks with a first ideal shape varying in a first dimension and the density of marks with a second ideal shape varying in a second dimension.

[0108] There are a plurality of other codes that can be used in connection with the present invention, the embodiments described above are only to be regarded as examples.

[0109] When an image of a position code has been recorded, the marks are identified by the dark continuous areas in the image being searched out. It is, however, the case that the dark continuous areas in the image are not necessarily a mark in the position code. There are sometimes noise particles, for example in the form of dust, on the surface on which the position code is printed. These noise particles can then be mistakenly identified as marks in the position code. In the first embodiment, in which the values of the marks are determined based on their distance from the ideal locations, there is however a factor that prevents any noise particles having an effect on the result of the position determination. If a good fit of a raster has been achieved for the recorded image, the “noise marks” will be located at a greater distance from the ideal locations than the marks in the position code. In the second embodiment, there is another factor that prevents the noise particles, or in reality the particles of dust, from having an effect on the result. The particles of dust are usually much smaller than the marks in the position code. When determining the raster point probabilities based on the value probabilities, their values will thus be rejected, since the value probabilities for particles of dust are lower than those for the marks in the position code.

[0110] There are two different parameters for the marks in the position codes have been discussed in this application, namely the location of the marks and their shape/size. Depending upon which position code is used, one of the parameters indicates the value of the marks. The parameter that is surplus can then suitably be used to calculate a probability of the identified mark being a mark in the position code.

[0111] In the case of the position code in which the values of the marks are defined by their location in relation to a raster, for example, the area of the marks can indicate the probability that the mark is a mark in the position code. The value probabilities for each mark can then be multiplied by the probability that the mark is a mark in the position code, before the raster point probabilities are calculated. An alternative to this method is that a form of area filter is used in the device to remove the noise marks completely at an early stage. This filter acts in such a way that all marks that have an area that lies between two limit values are identified as marks in the position code, while all marks outside the limit values are rejected.

[0112] In the case of the position code in which the marks are defined by their shape/size, for example, the location of the marks in relation to a raster can instead indicate the probability that the mark is a mark in the position code.

[0113] The device is arranged to calculate a position probability that the recorded image can give rise to a correct position determination on the surface. This can be carried out on a plurality of different occasions during the above described calculation of a position based on probabilities. For example, the position probability can be calculated by multiplication of the highest value probabilities for each of the marks in a set. The position probability can also be based on any of the other probabilities included in the above probability calculation.

[0114] The above described calculation of a position with associated probabilities can be interrupted at any time, if any of the probabilities included in the probability calculation is considered to be too low.

[0115] The conversion from difference values to coordinates can be carried out in many different ways, for example as described in Applicant's Application WO 01/26033 which is hereby incorporated by reference.

[0116] The embodiments described above are only to be regarded as examples.

[0117] A person skilled in the art will recognize that the above embodiments can be varied in a number of ways without deviating from the concept of the invention.

[0118] The position code can be of other types than the one described above. For example, it can be of the type described in U.S. Pat. No. 5,245,165, which is hereby incorporated by reference.

[0119] There are alternatives to optical recording of the position code, for example those described in PCT Application WO 00/73983, which is hereby incorporated by reference.

[0120] The device and the method according to the present invention are not limited to use in connection with coding of positions, but can also be used in other connections, for example for storage of data in accordance with PCT/SE01/00596, which is hereby incorporated by reference. 

What we claim and desire to secure by Letters Patent is:
 1. A device (1) for position determination which comprises a sensor (6) for recording an image of a position code (18) on a surface (4, 17), processing means (10) for determining a position on the surface based on the recorded image and at least a first writing means (11) for writing on the surface, characterized in that it is arranged to write on the surface by means of the first writing means, depending upon whether the position has been determined or not.
 2. A device (1) according to claim 1, characterized in that it is arranged to write on the surface (4, 17) by means of the first writing means (11) only if the position has been determined.
 3. A device (1) according to claim 1, characterized in that it is arranged, in the event that the position has been determined, to calculate a position probability that the position is correct.
 4. A device (1) according to claim 3, characterized in that it is arranged to write on the surface (4, 17) by means of the first writing means (11), depending upon whether the position probability exceeds a predetermined position limit value.
 5. A device (1) according to claim 4, characterized in that it is arranged to write on the surface (4, 17) by means of the first writing means (11) only if the position probability exceeds the predetermined position limit value.
 6. A device (1) according to any one of claims 3, 4 or 5, characterized in that it is arranged to identify marks (19) in the recorded image, each of which marks defines a number of possible values, to calculate, for each of the marks and for each of the values, a value probability that the mark defines this value and to determine the position on the surface depending upon said value probabilities.
 7. A device (1) according to claim 6, characterized in that it is arranged to calculate the position probability based on the highest value probabilities for each mark (19) in a set of identified marks and to determine the position depending upon the position probability.
 8. A device (1) according to claim 6 or 7, characterized in that it is arranged to identify in the image a raster (21) and to associate each of the marks (19) with a raster point (23) which consists of an intersection in the raster.
 9. A device (1) according to any one of claims 6-8, characterized in that it is arranged to identify marks, the value probabilities of which are defined by their size in relation to a number of ideal sizes of the marks.
 10. A device (1) according to claim 8, characterized in that it is arranged to identify marks (19), the value probabilities of which are defined by their location in relation to the raster points (23).
 11. A device (1) according to claim 10, characterized in that it is arranged to identify marks (19), the value probabilities of which are defined by their distance (27) to each of a number of ideal locations (26), one on each of the raster lines (22) that extend from the raster point (23) with which they are associated.
 12. A device (1) according to any one of the above claims, characterized in that it comprises a second writing means (44) for writing on the surface (4, 17) irrespective of whether the position has been determined or not.
 13. A device (1) according to any one of the preceding claims, characterized in that it comprises a second writing means (44) for writing on the surface (4, 17) in the positions in which the first writing means (43) is not writing.
 14. A device (1) according to any one of the above claims, characterized in that it further comprises a transceiver (13) for wireless transmission of data from the device to an external unit.
 15. A device (1) according to any one of the above claims, characterized in that the first writing means (11, 43) is a nozzle that is arranged to eject ink onto the surface (4, 17).
 16. A device (1) according to any one of claims 12-15, characterized in that the second writing means (44) is a nozzle that is arranged to eject ink onto the surface (4, 17).
 17. A device according to any one of the above claims, characterized in that it is handheld.
 18. A device according to any one of the preceding claims, which is arranged to eject ink when a position has been determined, depending upon the location of the position in relation to previously recorded positions.
 19. A device according to claim 18, which is arranged to eject ink only if the recorded position is within a predetermined distance from previously recorded positions.
 20. A method for position determination, which comprises the steps of recording an image of a position code (18) on a surface (4, 17) and processing the image to determine a position on the surface based on the recorded image, characterized in that it further comprises the step of writing on the surface, depending upon whether the position has been determined or not.
 21. A method according to claim 20, characterized in that it comprises the step of writing on the surface (4, 17) only if the position has been determined.
 22. A method according to claim 20 or 21, characterized in that it comprises the step of writing on the surface (4, 17) by ejecting ink.
 23. A memory medium on which is stored a computer program for position determination based on a digital image, which computer program comprises instructions that cause a computer to receive an image of a position code (18) on a surface (4, 17) as input, to process the image to determine a position and to provide as output information concerning whether the device is to write on the surface, depending upon whether the position has been determined or not.
 24. A device for position determination which is arranged to receive an image of a position code (18) on a surface (4, 17) as input, to process the image to determine a position and to provide as output information concerning whether the device is to write on the surface, depending upon whether the position has been determined or not.
 25. A device according to claim 24, which is an application-specific integrated circuit. 